Skip to content

Conversation

@mirzakhany
Copy link

Hi,

I have noticed that when editor background colour is set based on style, the selection colour is not rendered correctly.

This change will fix the issue for my use case but not 100% sure if it's the right fix for all.

Images from before and after the fix:

Before:
Screenshot 2025-11-01 at 11 30 25

After:
Screenshot 2025-11-01 at 11 30 53

@mirzakhany mirzakhany force-pushed the mohsen/paint-selection-color branch from 0229e8d to a9b767f Compare November 1, 2025 11:07
@oligo
Copy link
Owner

oligo commented Nov 1, 2025

Do you mean the background color styles set from syntax tokens or decorations? That will indeed overlay the selection layer and may make the selection layer invisible. The fix sounds good to me. I'll do some more test to confirm it.

@mirzakhany
Copy link
Author

In this example, I have set the syntax.ColorScheme.Background to the background colour from Chroma syntax highlighter.

@oligo
Copy link
Owner

oligo commented Nov 2, 2025

Hi, thanks for providing the details. There's a problem if we paint the selection layer after the text, as the text would look blurry or faded, severely impacting readability. There's an example that does not set the background(a lighter background color would also be ok):

Screenshot 2025-11-02 at 13 11 40

The text looks burry while the original painting order does not:

Screenshot 2025-11-02 at 13 13 48

The internal painter paint syntax background and decoration background before glyphs painting, for the selection layer, I would suggest using the same order to improve readability.

In your case, is it possible for you to just dismiss the background color for each single token? As the syntax token style painting is bound to the text painter, selection and text painting are processed during different phases, so I think we may not have a perfect solution for now. Separating syntax background style painting from text painting is possible but might be tricky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants